package org.yang.order.food.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.yang.order.food.common.Msg;
import org.yang.order.food.entity.Food;
import org.yang.order.food.service.FoodService;
import org.springframework.web.bind.annotation.*;

import com.github.pagehelper.PageInfo;

import javax.annotation.Resource;
/**
 * 食物控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2018/12/03
 */
@Api(value = "食物控制器",description="食物控制器")
@RestController
@RequestMapping("/food")
public class FoodController {
    @Resource
    private FoodService foodService;

    @ApiOperation("获取食物信息")
    @GetMapping("/getFoods")
    public PageInfo getFoods(Food food,Integer page,Integer limit){
        return foodService.getFoods(food,page,limit);
    }
    @PostMapping("/addFood")
    public Msg addFood(@RequestBody Food food){
        return foodService.addFood(food);
    }

    @PutMapping("/updateFood")
    public Msg updateFood(@RequestBody Food food){
        return foodService.updateFood(food);
    }

    @DeleteMapping("/delFood")
    public Msg delFood(Food food){
        return foodService.delFood(food);
    }
}
